/**
 * com.monte.persistence.command.DeleteEntityCommand.java
 * create by FengMy from 2013
 */
package com.monte.persistence.command;

import com.monte.persistence.CommandContext;
import com.monte.persistence.PersistenceCommand;

/**
 * @描述:删除实体命令
 * @author FengMy
 * @since 2013-3-4
 */
public class DeleteEntityCommand<T> implements PersistenceCommand {
	private T entity;
	
	public DeleteEntityCommand(T entity){
		this.entity = entity;
	}
	
	@Override
	public Object execute(CommandContext context) {
		if(entity!=null){
			context.getEntityManager().remove(entity);
			return 1;
		}
		return 0;
	}
}
